import {getLatestMonthsMilliseconds} from "../../../js/dateUtils";

let page = {
  total: 0,
  pageNum: 1,
  pageSize: 40,
  options: [40, 60, 80, 120],
};

let data = {
  list: [],
  selectedList: [],
};

const status = {
  states: [
    {value: -1, label: "已下架"},
    {value: 0, label: "已上架"},
    {value: -2, label: "已删除"},
    {value: 3, label: "新建未上架"}
  ],
  stateOnline: 0,
  stateOffline: -1,
  stateDeleted: -2,
  stateNew: 3,
  datePickerOptions: {
    shortcuts: [
      {
        text: '近三天',
        value () {
          const end = new Date();
          const start = new Date();
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 2);
          return [start, end];
        }
      },
      {
        text: '近一周',
        value () {
          const end = new Date();
          const start = new Date();
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 6);
          return [start, end];
        }
      },
      {
        text: '近一个月',
        value () {
          const end = new Date();
          const start = new Date();
          let millSeconds = getLatestMonthsMilliseconds(1, start);
          start.setTime(start.getTime() - millSeconds);
          return [start, end];
        }
      },
      /*{
        text: '近三个月',
        value () {
          const end = new Date();
          const start = new Date();
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
          return [start, end];
        }
      }*/
    ]
  },
};

let params = {
  search: "", //编号或名称
  categoryId: "",
  categoryLevel: null,
  state: null,
  startTime: null,
  endTime: null,
  selectedCatIds: [],
  selectedDate: null,
};

export default {
  tParam: params,
  tData: data,
  tPage: page,
  tStatus: status,
};
